home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / vbcc-src / doc / vbccalpha.doc < prev    next >
Text File  |  1999-01-01  |  4KB  |  134 lines

  1. vbcc - C compiler (c) in 1995-99 by Volker Barthelmann
  2.  
  3.  
  4. INTRODUCTION
  5.  
  6.     vbcc is a free portable and retargetable ANSI C compiler.
  7.     It is clearly split into a target independant and a target dependant
  8.     part and supports emulating datatypes of the target machine on any
  9.     other machine so that it is possible to e.g. make a crosscompiler for
  10.     a 64bit machine on a 32bit machine.
  11.     This document only deals with the target dependant parts of the
  12.     DEC Alpha version.
  13.  
  14.     This is a pre-alpha version!
  15.  
  16.  
  17. LEGAL
  18.  
  19.     vbcc is (c) in 1995-99 by Volker Barthelmann. All code is written by me
  20.     and may be freely redistributed as long as no modifications are made
  21.     and nothing is charged for it.
  22.     Non-commercial usage of vbcc is allowed without any restrictions.
  23.     Commercial usage needs my written consent.
  24.  
  25.     Sending me money, gifts, postcards etc. would of course be very nice
  26.     and may encourage further development of vbcc, but is not legally or
  27.     morally necessary to use vbcc.
  28.  
  29.  
  30. ADDITIONAL OPTIONS FOR THIS VERSION
  31.  
  32.     -merge-constants
  33.  
  34.                 Place identical floating point constants at the same
  35.                 memory location. This can reduce program size and increase
  36.                 compilation time.
  37.  
  38.     -const-in-data
  39.  
  40.                 By default constant data will be placed in the code
  41.                 section (and therefore is accessable with faster pc-relative
  42.                 addressing modes). Using this option it will be placed in the
  43.                 data section.
  44.                 Note that on operating systems with memory protection this
  45.                 option will disable write-protection of constant data.
  46.  
  47.     -no-builtins
  48.  
  49.                 Do not replace certain builtin functions by inline code.
  50.                 This may be useful if you use this code generator with
  51.                 another frontend than vbcc.
  52.                 stdarg.h will not work with -no-builtins.
  53.  
  54.  
  55. SOME INTERNALS
  56.  
  57.     The current version generates assembly output for use with the GNU
  58.     assembler. The generated code should work on systems with 21064,
  59.     21066, 21164 and higher Alpha CPUs.
  60.  
  61.     The register names are:
  62.  
  63.         $0 through $31 for the general purpose registers and
  64.         $f0 through $f31 for the floating point registers
  65.  
  66.     The registers $0-$8, $16-$28, $f0, $f1 and $f10-$f30
  67.     are used as scratch registers (i.e. they can be destroyed in function
  68.     calls), all other registers are preserved. Of course $31 and $f31
  69.     cannot be used.
  70.  
  71.     The first 6 function arguments which have arithmetic or pointer types
  72.     are passed in registers $16/$f16 through $21/$f21.
  73.  
  74.     Integers and pointers are returned in $0, floats and doubles in $f0.
  75.     All other types are returned by passing the function the address
  76.     of the result as a hidden argument - so when you call such a function
  77.     without a proper declaration in scope you can expect a crash.
  78.  
  79.     The elementary data types are represented like:
  80.  
  81.     type        size in bits        alignment in bytes
  82.  
  83.     char                8                       1
  84.     short              16                       2
  85.     int                32                       4
  86.     long               64                       8
  87.     all pointers       64                       8
  88.     float              32                       4
  89.     double             64                       8
  90.  
  91.  
  92. STDARG
  93.  
  94.     A possible <stdarg.h> could look like this:
  95.  
  96.     typedef struct {
  97.       char *regbase;
  98.       char *membase;
  99.       int arg;
  100.     } va_list;
  101.  
  102.     char *__va_start(void);
  103.     int __va_fixargs(void);
  104.  
  105.     #define va_start(vl,dummy) \
  106.     (vl.arg=__va_fixargs(),vl.regbase=__va_start(),vl.membase=vl.regbase+(6-vl.arg)*16)
  107.  
  108.     #define va_end(vl) (vl.regbase=vl.membase=0)
  109.  
  110.     #define __va_size(type) ((sizeof(type)+7)/8*8)
  111.     #define va_arg(vl,type) \
  112.      ( \
  113.       ((__typeof(type)&15)<=8&&++vl.arg<=6) ? \
  114.        ( \
  115.         ((__typeof(type)&15)==5||(__typeof(type)&15)==6) ? \
  116.           (vl.regbase+=16,*(type *)(vl.regbase-8)) \
  117.         : \
  118.           (vl.regbase+=16,*(type *)(vl.regbase-16)) \
  119.        ) \
  120.       : \
  121.        (vl.membase+=__va_size(type),*(type *)(vl.membase-__va_size(type))) \
  122.      )
  123.  
  124.  
  125. KNOWN PROBLEMS
  126.  
  127.     - generated code is very poor
  128.     - nested function calls which pass parameters on the stack will not work
  129.     - several other problems
  130.  
  131.  
  132. Volker Barthelmann                                      volker@vb.franken.de
  133.  
  134.